{extend name="public:layout" /}
{block name="title"}支付方式{/block}
{block name="head"}
{:widget('common/Form/icheckRes')}{:widget('common/Form/validRes')}
{/block}
{block name="body"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> <a href="{:url('index')}">支付方式</a></li>
                <li class="active">配置支付方式</li>
            </ol>
        </div>
        <div class="ibox-content">
            <form method="post" class="form-horizontal" id="form">
                <div class="form-group">
                    <label class="col-sm-2 control-label">支付名称</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" placeholder="请输入支付名称"
                               name="pay_name" datatype="*" value="{$info.pay_name}"/>
                    </div>
                    <label class="col-sm-2 control-label">支付标识</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" placeholder="请输入支付标识"
                               name="pay_code" datatype="*" value="{$info.pay_code}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">描述</label>
                    <div class="col-sm-10">
                        <textarea name="pay_desc" class="form-control" cols="3" placeholder="请输入支付描述"></textarea>
                    </div>
                </div>
                {switch name="info.pay_code"}
                {case value="alipay"}
                <div class="form-group">
                    <label class="col-sm-2 control-label">合作者ID</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="pay_config[partner]" value="{$info.pay_config.partner}" />
                    </div>
                    <label class="col-sm-2 control-label">支付KEY</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="pay_config[md5_key]" value="{$info.pay_config.md5_key}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">支付宝私钥地址</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="pay_config[rsa_private_key]" value="{$info.pay_config.rsa_private_key}" />
                        <p class="help-block">不填表示签名采用"MD5"方式验签，否则采用"RSA"方式验签</p>
                    </div>
                </div>
                {/case}
                {case value="wxpay"}
                <div class="form-group">
                    <label class="col-sm-2 control-label">APPID</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="pay_config[app_id]" value="{$info.pay_config.app_id}" />
                    </div>
                    <label class="col-sm-2 control-label">商户号</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="pay_config[mch_id]" value="{$info.pay_config.mch_id}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">支付密钥</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="pay_config[md5_key]" value="{$info.pay_config.md5_key}" />
                    </div>
                    <label class="col-sm-2 control-label">公众帐号secert</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="pay_config[appsecret]" value="{$info.pay_config.appsecret}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">apiclient_key.pem</label>
                    <div class="col-sm-4">
                        <p class="form-control-static">
                            {:widget('common/Form/singleFile',['field'=>'pay_config[apiclient_key]','value'=>$info['pay_config']['apiclient_key']])}
                        </p>
                    </div>
                    <label class="col-sm-2 control-label">apiclient_cert.pem</label>
                    <div class="col-sm-4">
                        <p class="form-control-static">
                            {:widget('common/Form/singleFile',['field'=>'pay_config[apiclient_cert]','value'=>$info['pay_config']['apiclient_cert']])}
                        </p>
                    </div>
                </div>
                {/case}
                {/switch}
                <div class="form-group">
                    <label class="col-sm-2 control-label">状态</label>

                    <div class="col-sm-4">
                        <label class="radio-inline i-checks">
                            <input type="radio" name="enabled" value="1" {eq name="info.enabled" value="1"}checked{/eq}> 正常
                        </label>
                        <label class="radio-inline i-checks">
                            <input type="radio" name="enabled" value="0" {eq name="info.enabled" value="0"}checked{/eq}> 锁定
                        </label>
                    </div>
                    <label class="col-sm-2 control-label">排序</label>

                    <div class="col-sm-2">
                        <input type="text" class="form-control" placeholder="请输入支付名称"
                               name="pay_sort" datatype="*" value="{$info.pay_sort}"/>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-10 col-sm-offset-2">
                        <button class="btn btn-primary"
                                onclick="ajaxSubForm();" type="submit">
                            保存内容
                        </button>
                        <a href="{:url('index',['type_id'=>$Request.param.type_id])}" class="btn btn-white">取消</a>
                        <span id="validError"></span>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    $(function () {
        iCheck();
    })
</script>
{/block}